{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "40dce44c-d33c-4acf-bdde-1e4970404c1e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "信息计算221 刘显婷 224180117\n",
      "重复值如下：\n",
      "       工号  姓名          日期           时段     交易额    柜台\n",
      "104  1006  钱八  2019-03-13  14：00-21：00  1609.0  蔬菜水果\n",
      "缺失值情况：\n",
      "工号     0\n",
      "姓名     0\n",
      "日期     0\n",
      "时段     0\n",
      "交易额    3\n",
      "柜台     0\n",
      "dtype: int64\n",
      "填充后的缺失值情况：\n",
      "工号     0\n",
      "姓名     0\n",
      "日期     0\n",
      "时段     0\n",
      "交易额    0\n",
      "柜台     0\n",
      "dtype: int64\n",
      "3σ原则下的异常值：\n",
      "       工号  姓名          日期           时段        交易额    柜台\n",
      "132  1006  钱八  2019-03-17  14：00-21：00  8600000.0  蔬菜水果\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAGsCAYAAACB/u5dAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAVh0lEQVR4nO3db4xVhfng8WcY46jIjIUuLsRBRqhKZbRUTKM4Xdg2VjT8nFrdxmpjqSbrZvxLmyitbX9YZaJB64umNloCshZ0dfljsY2wbVBUTBBsLUkLgrawoqG0ei8gueLM3RctszsLyNyZZ2YY+HySm3DPPeeehxfkfjnn3HuqyuVyOQAAEgzq7wEAgKOHsAAA0ggLACCNsAAA0ggLACCNsAAA0ggLACCNsAAA0ggLACCNsAAA0vRbWLz44osxbdq0GDlyZFRVVcXSpUsrfo9yuRxz5syJM888M2pqaqK+vj5mz56dPywA0CXH9deO9+zZE+edd15Mnz49vva1r3XrPW677bZYsWJFzJkzJxobG6NQKMTOnTuTJwUAuqrqSLgJ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0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0FYfFO++8E9ddd10MGzYsTjrppPjc5z4X69at643ZAIAB5rhKVn7//fdj0qRJMWXKlPjNb34Tw4cPjy1btsQpp5zSS+MBAANJRWFx//33R319fcybN69j2ejRo7NnAgAGqIpOhTz77LMxceLEuPrqq2P48OExYcKEeOyxxz5xm1KpFMVisdMDADg6VRQWb731VjzyyCPxmc98Jp5//vm46aab4tZbb40FCxYccpvW1taoq6vreNTX1/d4aADgyFRVLpfLXV35+OOPj4kTJ8Yrr7zSsezWW2+NtWvXxpo1aw66TalUilKp1PG8WCxGfX19FAqFqK2t7cHoAEBfKRaLUVdXd9jP74qOWIwYMSI++9nPdlo2bty42Lp16yG3qampidra2k4PAODoVFFYTJo0KTZu3Nhp2aZNm+L0009PHQoAGJgqCos77rgjXn311Zg9e3Zs3rw5Fi5cGI8++mi0tLT01nwAwABSUVhccMEFsWTJkli0aFGMHz8+fvzjH8fDDz8c1157bW/NBwAMIBVdvJmhqxd/AABHjl65eBMA4JMICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANIICwAgjbAAANL0KCxaW1ujqqoqbr/99qRxAICBrNthsXbt2nj00Ufj3HPPzZwHABjAuhUWu3fvjmuvvTYee+yx+NSnPpU9EwAwQHUrLFpaWuLyyy+PL3/5y4ddt1QqRbFY7PQAAI5Ox1W6wZNPPhnr16+PtWvXdmn91tbWmDVrVsWDAQADT0VHLLZt2xa33XZbPPHEE3HCCSd0aZuZM2dGoVDoeGzbtq1bgwIAR76qcrlc7urKS5cuja9+9atRXV3dsaytrS2qqqpi0KBBUSqVOr12MMViMerq6qJQKERtbW33JwcA+kxXP78rOhXypS99Kf74xz92WjZ9+vQ4++yz48477zxsVAAAR7eKwmLIkCExfvz4TssGDx4cw4YNO2A5AHDs8cubAECair8V8v9btWpVwhgAwNHAEQsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAIE1FYdHa2hoXXHBBDBkyJIYPHx7Nzc2xcePG3poNABhgKgqLF154IVpaWuLVV1+NlStXxscffxyXXHJJ7Nmzp7fmAwAGkKpyuVzu7sZ/+9vfYvjw4fHCCy/EF7/4xS5tUywWo66uLgqFQtTW1nZ31wBAH+rq5/dxPdlJoVCIiIihQ4cecp1SqRSlUqnTYADA0anbF2+Wy+WYMWNGXHzxxTF+/PhDrtfa2hp1dXUdj/r6+u7uEgA4wnX7VEhLS0s899xz8dJLL8Vpp512yPUOdsSivr7eqRAAGEB69VTILbfcEs8++2y8+OKLnxgVERE1NTVRU1PTnd0AAANMRWFRLpfjlltuiSVLlsSqVauioaGht+YCAAagisKipaUlFi5cGMuWLYshQ4bEe++9FxERdXV1ceKJJ/bKgADAwFHRNRZVVVUHXT5v3rz41re+1aX38HVTABh4euUaix785AUAcAxwrxAAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAADSCAsAII2wAFLs3bs3br755vjKV74SN998c+zdu7e/RwL6QVW5XC735Q6LxWLU1dVFoVCI2travtw10Euam5tj2bJlByy/4oorYunSpX0/EJCuq5/f3Tpi8bOf/SwaGhrihBNOiPPPPz9Wr17d7UGBge1QURERsWzZsmhubu7bgYB+VXFYPPXUU3H77bfH97///Xj99dejqakppk6dGlu3bu2N+YAj2N69eztFxaWXXhpr1qyJSy+9tGPZsmXLnBaBY0jFp0K+8IUvxOc///l45JFHOpaNGzcumpubo7W19bDbOxUCR48bb7wx5s6dGxERe/bsiZNOOqnjtQ8//DAGDx4cERE33HBD/OIXv+iXGYEcXf38Pq6SN/3oo49i3bp1cdddd3Vafskll8Qrr7xy0G1KpVKUSqVOgwE9s3Pnznj+fy6Ik9p6/u/pww/3xJYtb3Vr2zeeXx4T/uOgGDp0aMz5zjcPeP0/jxsW77//frzx/H+Pe/7b+xW//5gxZ8RJJw3u1mz/r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v/738fQoUNj1KhR/TgZ0Nfc3RTosVWrVsWUKVMOWH799dfH/Pnz+34goN8ICwAgjWssAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASCMsAIA0wgIASPN/ALzOQC8gYf++AAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "使用箱线图查看异常值: \n",
      " [5.30000000e+01 9.80000000e+01 1.14000000e+02 1.21000000e+04\n",
      " 3.64277878e+04 3.64277878e+04 8.60000000e+06 3.64277878e+04\n",
      " 9.03100000e+03]\n",
      "信息计算221 刘显婷 224180117\n"
     ]
    }
   ],
   "source": [
    "print('信息计算221 刘显婷 224180117')\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "# 读取 Excel 文件\n",
    "data = pd.read_excel(\"D:/Users/19202/Desktop/超市营业额.xlsx\", sheet_name='Sheet1')\n",
    "# 1. 查看并处理重复值\n",
    "# 查看是否有重复值\n",
    "duplicated_rows = data[data.duplicated()]\n",
    "if len(duplicated_rows) > 0:\n",
    "    print(\"重复值如下：\")\n",
    "    print(duplicated_rows)\n",
    "    # 删除重复值\n",
    "    data = data.drop_duplicates()\n",
    "else:\n",
    "    print(\"无重复值\")\n",
    "# 2. 查看并处理缺失值\n",
    "# 查看缺失值情况\n",
    "missing_data = data.isnull().sum()\n",
    "print(\"缺失值情况：\")\n",
    "print(missing_data)\n",
    "# 如果交易额有缺失值，用均值填充\n",
    "if missing_data['交易额'] > 0:\n",
    "    mean_value = data['交易额'].mean()\n",
    "    data = data.assign(交易额=data['交易额'].fillna(mean_value))\n",
    "print(\"填充后的缺失值情况：\")\n",
    "print(data.isnull().sum())\n",
    "# 3. 使用 3σ原则查看异常值\n",
    "# 计算交易额的均值和标准差\n",
    "mean = data['交易额'].mean()\n",
    "std = data['交易额'].std()\n",
    "lower_bound_3sigma = mean - 3 * std\n",
    "upper_bound_3sigma = mean + 3 * std\n",
    "outliers_3sigma = data[(data['交易额'] < lower_bound_3sigma) | (data['交易额'] > upper_bound_3sigma)]\n",
    "print(\"3σ原则下的异常值：\")\n",
    "print(outliers_3sigma)\n",
    "# 使用箱线图查看异常值\n",
    "p = plt.boxplot(data['交易额'])\n",
    "plt.show()\n",
    "print('使用箱线图查看异常值: \\n',p['fliers'][0].get_ydata())\n",
    "print('信息计算221 刘显婷 224180117')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2bd27d14-d43d-42bd-a262-581dce9f08e8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "       工号 姓名_x          日期           时段     交易额    柜台 姓名_y  职级\n",
      "0    1001   张三  2019-03-01   9：00-14：00  1664.0     0   张三  店长\n",
      "1    1002   李四  2019-03-01  14：00-21：00   954.0     0   李四  主管\n",
      "2    1003   王五  2019-03-01   9：00-14：00  1407.0     1   王五  组长\n",
      "3    1004   赵六  2019-03-01  14：00-21：00  1320.0     1   赵六  员工\n",
      "4    1005   周七  2019-03-01   9：00-14：00   994.0   日用品   周七  员工\n",
      "..    ...  ...         ...          ...     ...   ...  ...  ..\n",
      "252  1004   赵六  2019-04-01  14：00-21：00  1270.0    食品   赵六  员工\n",
      "253  1005   周七  2019-04-01   9：00-14：00  1123.0   日用品   周七  员工\n",
      "254  1006   钱八  2019-04-01  14：00-21：00  1321.0   日用品   钱八  员工\n",
      "255  1007   孙九  2019-04-01   9：00-14：00  1364.0  蔬菜水果   孙九  员工\n",
      "256  1007   孙九  2019-04-01  14：00-21：00  1633.0  蔬菜水果   孙九  员工\n",
      "\n",
      "[257 rows x 8 columns]\n",
      "信息计算221 刘显婷 224180117\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "# 读取 Excel 文件的各个工作表\n",
    "lxt1_data = pd.read_excel(\"D:/Users/19202/Desktop/超市营业额.xlsx\", sheet_name='Sheet1')\n",
    "lxt2_data = pd.read_excel(\"D:/Users/19202/Desktop/超市营业额.xlsx\", sheet_name='Sheet2')\n",
    "lxt3_data = pd.read_excel(\"D:/Users/19202/Desktop/超市营业额.xlsx\" ,sheet_name='Sheet3')\n",
    "# 将 Sheet1 和 Sheet2 数据进行纵向连接\n",
    "zxlj_data = pd.concat([lxt1_data, lxt2_data], ignore_index=True)\n",
    "# 按照“工号”与 Sheet3 数据进行合并\n",
    "hb_data = zxlj_data.merge(lxt3_data, on='工号', how='left')\n",
    "# 打印合并后的数据\n",
    "print(hb_data)\n",
    "print('信息计算221 刘显婷 224180117')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "dd9f5718-4af1-4cd9-95e0-983f0cd25cd1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "       工号  姓名          日期           时段       交易额 柜台\n",
      "0    1001  张三  2019-03-01   9：00-14：00 -0.063281  0\n",
      "1    1002  李四  2019-03-01  14：00-21：00 -0.064579  0\n",
      "2    1003  王五  2019-03-01   9：00-14：00 -0.063751  1\n",
      "3    1004  赵六  2019-03-01  14：00-21：00 -0.063910  1\n",
      "4    1005  周七  2019-03-01   9：00-14：00 -0.064506  2\n",
      "..    ...  ..         ...          ...       ... ..\n",
      "244  1002  李四  2019-03-31  14：00-21：00 -0.064753  3\n",
      "245  1004  赵六  2019-03-31   9：00-14：00 -0.063274  2\n",
      "246  1004  赵六  2019-03-31  14：00-21：00 -0.063175  2\n",
      "247  1003  王五  2019-03-31   9：00-14：00 -0.063994  1\n",
      "248  1006  钱八  2019-03-31  14：00-21：00 -0.064839  1\n",
      "\n",
      "[249 rows x 6 columns]\n",
      "信息计算221 刘显婷 224180117\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from sklearn import preprocessing\n",
    "pd.set_option('future.no_silent_downcasting', True)\n",
    "df = pd.read_excel(\"D:/Users/19202/Desktop/超市营业额.xlsx\", sheet_name='Sheet1')\n",
    "# 类别型数据变换\n",
    "replacement_dict = {'化妆品': 0, '食品': 1, '日用品': 2, '蔬菜水果': 3}\n",
    "df['柜台'] = df['柜台'].replace(replacement_dict)\n",
    "# 数据标准化\n",
    "standard_scaler = preprocessing.StandardScaler()\n",
    "df['交易额'] = standard_scaler.fit_transform(df['交易额'].values.reshape(-1, 1))\n",
    "print(df)\n",
    "print('信息计算221 刘显婷 224180117')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6d16fdf9-b4e3-4e85-bf6d-398d03b44cbe",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
